package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.DigitalCollectionProductInfoAuctionCondition;
import com.sc.nft.entity.DigitalCollectionProductInfoAuctionConsumptionCondition;
import com.sc.nft.mapper.DigitalCollectionProductInfoAuctionConditionMapper;
import com.sc.nft.mapper.DigitalCollectionProductInfoAuctionConsumptionConditionMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author：LiGen
 * @Package：com.sc.nft.dao
 * @Project：sc_metago
 * @name：DigitalCollectionProductInfoAuctionDao
 * @Date：2024/9/5 14:57
 * @Filename：DigitalCollectionProductInfoAuctionDao
 */
@Slf4j
@Repository
public class DigitalCollectionProductInfoAuctionConsumptionConditionDao extends ServiceImpl<DigitalCollectionProductInfoAuctionConsumptionConditionMapper, DigitalCollectionProductInfoAuctionConsumptionCondition> {

    public void removeByProductId(Long id) {
        LambdaUpdateWrapper<DigitalCollectionProductInfoAuctionConsumptionCondition> wrapper = Wrappers.lambdaUpdate();
        wrapper.eq(DigitalCollectionProductInfoAuctionConsumptionCondition::getProductId,id);
        remove(wrapper);
    }


    public List<DigitalCollectionProductInfoAuctionConsumptionCondition> getDigitalCollectionProductInfoAuctionConsumptionConditionByProductId(Long id) {
        LambdaQueryWrapper<DigitalCollectionProductInfoAuctionConsumptionCondition> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(DigitalCollectionProductInfoAuctionConsumptionCondition::getProductId, id);
        return baseMapper.selectList(wrapper);
    }
    public List<DigitalCollectionProductInfoAuctionConsumptionCondition> listByProductId(Long productId) {
        LambdaQueryWrapper<DigitalCollectionProductInfoAuctionConsumptionCondition> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(DigitalCollectionProductInfoAuctionConsumptionCondition::getProductId,productId);
        return this.list(queryWrapper);
    }
}
